<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link href="/lib/layui/css/layui.css" rel="stylesheet"/>
    <link href="/css/common.css" rel="stylesheet"/>
    <title>登录</title>
    <style>
        html, body {
            height: 100%
        }
    </style>
</head>
<body>
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
    <div class="layadmin-user-login-main">
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
                <input type="text" name="loginName" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input" autocomplete="off"
                       value="admin">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
                <input type="password" name="userPassword" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input"
                       autocomplete="off" value="123456">
            </div>
            <div class="layui-form-item">
                <div id="slider"></div>
            </div>
            <div class="layui-form-item">
                <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">登 入</button>
            </div>
            <div class="layui-trans layui-form-item layadmin-user-login-other">
                <a href="/register.html" class="layadmin-link">注册帐号</a>
                <a href="/reset.html" class="layadmin-user-jump-change layadmin-link">重置密码</a>
            </div>
        </div>
    </div>
</div>
<script src="/lib/layui/layui.all.js" charset="utf-8"></script>
<script src="/script/common.js" charset="utf-8"></script>
<script>
    layui.$('#LAY-user-login').attr('style', 'padding:' + (document.body.clientHeight - 307) / 2 + 'px 0;');
    layui.use(['baseUtil', 'sliderVerify'], function () {
        var form = layui.form,
            baseUtil = layui.baseUtil,
            sliderVerify = layui.sliderVerify;

        sliderVerify.render({ elem: '#slider', isAutoVerify: true });

        form.on('submit(LAY-user-login-submit)', function (obj) {
            baseUtil.doPostData('/sysUser/login', obj.field, function (data) {
                setAccessToken(data.token);
                window.location.href = '/index.html';
            });
        });
    });
</script>
</body>
</html>
